package 自定义数据库连接池;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class test2 {
    public static void main(String[] args) {
        MyDataSource2 ds = new MyDataSource2();

        Connection con = null;
        Statement stat = null;
        ResultSet rs = null;

        try {
            String sql = "select * from emp;";
            con = ds.getConnection();
            stat = con.createStatement();
            rs = stat.executeQuery(sql);
            while (rs.next()) {
                System.out.println(rs.getString("ename"));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            JDBCUtils.release(con, stat, rs);
        }
    }
}
